/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sessionBean;

import entity.Faq;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author VietTien
 */
@Stateless
public class FAQSessionBean implements FAQSessionBeanLocal {

    @PersistenceContext(unitName = "BluePumpkin-ejbPU")
    private EntityManager em;

    public void persist(Object object) {
        em.persist(object);
    }

    public boolean insertFAQ(Faq faq) {
         em.persist(faq);
        return true;
        
    }

    public boolean deleteFAQ(Faq faq) {
         em.remove(em.merge(faq));
        return true;
    }

    public boolean updateFAQ(Faq faq) {
       em.merge(faq);
        return true;
    }

    public List getAllFAQs() {
        return em.createNamedQuery("Faq.findAll").getResultList();
    }



    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
   
}
